//
//  HomeSleepDataView.m
//  Ginix
//
//  Created by 冯志强 on 2025/2/21.
//

#import "HomeSleepDataView.h"

@interface HomeSleepDataView()
@property (nonatomic,strong) UIView * view1;
@property (nonatomic,strong) UIView * view2;
@property (nonatomic,strong) UIView * view3;
@property (nonatomic,strong) UIView * view4;
@property (nonatomic,strong) UIView * view5;
@property (nonatomic,strong) UIView * view6;
@property (nonatomic,strong) UIView * view7;
@property (nonatomic,strong) UIView * view8;

@property (nonatomic,strong) UIView * view9;
@property (nonatomic,strong) UIView * view10;
@property (nonatomic,strong) UIView * view11;
@property (nonatomic,strong) UIView * view12;

@property (nonatomic,strong) UILabel * nameLabel;
@property (nonatomic,strong) UILabel * infoLabel;


@property (nonatomic,strong) UILabel * label1;
@property (nonatomic,strong) UILabel * label2;
@property (nonatomic,strong) UILabel * label3;
@property (nonatomic,strong) UILabel * label4;

@end

@implementation HomeSleepDataView

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        [self setSubViewLayout];
    }
    return self;
}

-(void)setSubViewLayout{
    
    CGFloat width = (WIDTH - 70 * FMScaleX) / 4;
    
    [self addSubview:self.view1];
    [_view1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(@0);
        make.size.mas_offset(CGSizeMake(width, 50 * FMScaleX));
    }];
    [self addSubview:self.view2];
    [_view2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.height.equalTo(self.view1);
        make.left.equalTo(self.view1.mas_right).offset(2 * FMScaleX);
        make.width.mas_offset(width);
    }];
    [self addSubview:self.view3];
    [_view3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.height.equalTo(self.view1);
        make.left.equalTo(self.view2.mas_right).offset(2 * FMScaleX);
        make.width.mas_offset(width);
    }];
    [self addSubview:self.view4];
    [_view4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.height.equalTo(self.view1);
        make.left.equalTo(self.view3.mas_right).offset(2 * FMScaleX);
        make.width.mas_offset(width);
    }];
    [self addSubview:self.view5];
    [_view5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.centerX.equalTo(self.view1);
        make.top.equalTo(self.view1.mas_bottom).offset(3 * FMScaleX);
    }];
    [self addSubview:self.view6];
    [_view6 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.centerX.equalTo(self.view2);
        make.top.equalTo(self.view2.mas_bottom).offset(3 * FMScaleX);
    }];
    [self addSubview:self.view7];
    [_view7 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.centerX.equalTo(self.view3);
        make.top.equalTo(self.view4.mas_bottom).offset(3 * FMScaleX);
    }];
    [self addSubview:self.view8];
    [_view8 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.centerX.equalTo(self.view4);
        make.top.equalTo(self.view4.mas_bottom).offset(3 * FMScaleX);
    }];
    [self addSubview:self.view9];
    [_view9 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.centerX.equalTo(self.view5);
        make.top.equalTo(self.view5.mas_bottom).offset(0 * FMScaleX);
        make.height.mas_offset(3* FMScaleX);
    }];
    [self addSubview:self.view10];
    [_view10 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.centerX.equalTo(self.view6);
        make.top.equalTo(self.view6.mas_bottom).offset(0 * FMScaleX);
        make.height.mas_offset(3* FMScaleX);
    }];
    [self addSubview:self.view11];
    [_view11 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.centerX.equalTo(self.view7);
        make.top.equalTo(self.view7.mas_bottom).offset(0 * FMScaleX);
        make.height.mas_offset(3* FMScaleX);
    }];
    [self addSubview:self.view12];
    [_view12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.centerX.equalTo(self.view8);
        make.top.equalTo(self.view8.mas_bottom).offset(0 * FMScaleX);
        make.height.mas_offset(3* FMScaleX);
    }];
    [self addSubview:self.nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view9);
        make.top.equalTo(self.view9.mas_bottom).offset(2 * FMScaleX);
    }];
    [self addSubview:self.infoLabel];
    [_infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view12);
        make.top.equalTo(self.view12.mas_bottom).offset(2 * FMScaleX);
    }];
    [self addSubview:self.label1];
    [_label1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view9);
        make.top.equalTo(self.view9.mas_bottom).offset(18 * FMScaleX);
    }];
    [self addSubview:self.label2];
    [_label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view10);
        make.top.equalTo(self.view10.mas_bottom).offset(18 * FMScaleX);
    }];
    [self addSubview:self.label3];
    [_label3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view11);
        make.top.equalTo(self.view11.mas_bottom).offset(18 * FMScaleX);
    }];
    [self addSubview:self.label4];
    [_label4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view12);
        make.top.equalTo(self.view12.mas_bottom).offset(18 * FMScaleX);
    }];
}
-(UIView *)view1{
    
    if (!_view1) {
        _view1 = [[UIView alloc]init];
        _view1.backgroundColor = RDRGB(0xF6F2ED);
    }
    return _view1;
}
-(UIView *)view2{
    
    if (!_view2) {
        _view2 = [[UIView alloc]init];
        _view2.backgroundColor = RDRGB(0xF6F2ED);
    }
    return _view2;
}
-(UIView *)view3{
    
    if (!_view3) {
        _view3 = [[UIView alloc]init];
        _view3.backgroundColor = RDRGB(0xF6F2ED);
    }
    return _view3;
}
-(UIView *)view4{
    
    if (!_view4) {
        _view4 = [[UIView alloc]init];
        _view4.backgroundColor = RDRGB(0xF6F2ED);
    }
    return _view4;
}
-(UIView *)view5{
    
    if (!_view5) {
        _view5 = [[UIView alloc]init];
        _view5.backgroundColor = RDRGB(0xF6F2ED);
    }
    return _view5;
}
-(UIView *)view6{
    
    if (!_view6) {
        _view6 = [[UIView alloc]init];
        _view6.backgroundColor = RDRGB(0xF6F2ED);
    }
    return _view6;
}
-(UIView *)view7{
    
    if (!_view7) {
        _view7 = [[UIView alloc]init];
        _view7.backgroundColor = RDRGB(0xF6F2ED);
    }
    return _view7;
}
-(UIView *)view8{
    
    if (!_view8) {
        _view8 = [[UIView alloc]init];
        _view8.backgroundColor = RDRGB(0xF6F2ED);
    }
    return _view8;
}
-(UIView *)view9{
    
    if (!_view9) {
        _view9 = [[UIView alloc]init];
        _view9.backgroundColor = RDRGB(0x799BE8);
    }
    return _view9;
}
-(UIView *)view10{
    
    if (!_view10) {
        _view10 = [[UIView alloc]init];
        _view10.backgroundColor = RDRGB(0x6FBBA4);
    }
    return _view10;
}
-(UIView *)view11{
    
    if (!_view11) {
        _view11 = [[UIView alloc]init];
        _view11.backgroundColor = RDRGB(0xF3B66E);
    }
    return _view11;
}
-(UIView *)view12{
    
    if (!_view12) {
        _view12 = [[UIView alloc]init];
        _view12.backgroundColor = RDRGB(0xF295A5);
    }
    return _view12;
}
-(UILabel *)nameLabel{
    
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.font = Regular(13);
        _nameLabel.textColor = RDRGB(0x999999);
        _nameLabel.text = @"1";
    }
    return _nameLabel;
}
-(UILabel *)infoLabel{
    
    if (!_infoLabel) {
        _infoLabel = [[UILabel alloc]init];
        _infoLabel.font = Regular(13);
        _infoLabel.textColor = RDRGB(0x999999);
        _infoLabel.text = @"100";
    }
    return _infoLabel;
}
-(UILabel *)label1{
    
    if (!_label1) {
        _label1 = [[UILabel alloc]init];
        _label1.font = Regular(13);
        _label1.textColor = RDRGB(0x555555);
        _label1.text = @"放松";
    }
    return _label1;
}
-(UILabel *)label2{
    
    if (!_label2) {
        _label2 = [[UILabel alloc]init];
        _label2.font = Regular(13);
        _label2.textColor = RDRGB(0x555555);
        _label2.text = @"正常";
    }
    return _label2;
}
-(UILabel *)label3{
    
    if (!_label3) {
        _label3 = [[UILabel alloc]init];
        _label3.font = Regular(13);
        _label3.textColor = RDRGB(0x555555);
        _label3.text = @"中等";
    }
    return _label3;
}
-(UILabel *)label4{
    
    if (!_label4) {
        _label4 = [[UILabel alloc]init];
        _label4.font = Regular(13);
        _label4.textColor = RDRGB(0x555555);
        _label4.text = @"偏高";
    }
    return _label4;
}
@end
